//
//  MBInterestsCell.m
//  Meboo
//
//  Created by kyo on 2024/3/13.
//

#import "MBInterestsCell.h"
@interface MBInterestsCell()
@property(nonatomic,strong) UIButton *titleBtn;
@end

@implementation MBInterestsCell
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

#pragma mark - Public Metohd
- (void)setModel:(KLInterestsModel *)model {
    _model = model;
    [self.titleBtn setTitle:model.interest forState:0];
    if (model.selected) {
        [self.titleBtn setBackgroundColor:HEXS(@"D1C8FF")];
    } else {
        [self.titleBtn setBackgroundColor:HEXS(@"ffffff")];
    }
}
#pragma mark - Action

#pragma mark - UI
- (void)setupUI {
    self.contentView.backgroundColor = UIColor.clearColor;
    
    [self.contentView addSubview:self.titleBtn];
    [self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
}

#pragma mark - Setter && Getter

//- (UILabel *)titleLab {
//    if (!_titleLab) {
//        _titleLab = [UILabel new];
//        _titleLab.textAlignment = NSTextAlignmentCenter;
//        _titleLab.textColor = HEXS(@"333333");
//        _titleLab.font = MBHelFontSizeScale(15);
//    }
//    return _titleLab;
//}
- (UIButton *)titleBtn {
    if (!_titleBtn) {
        _titleBtn = [UIButton new];
        _titleBtn.userInteractionEnabled = NO;
        [_titleBtn setBackgroundColor:HEXS(@"ffffff")];
        [_titleBtn setTitleColor:HEXS(@"333333") forState:0];
        _titleBtn.layer.cornerRadius = MBHeightScale(14);
        _titleBtn.titleLabel.font = MBHelFontSizeScale(15);
    }
    return _titleBtn;
}
@end
